package com.AO.DAO;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user", catalog = "delicacy")
public class User implements java.io.Serializable {

	// Fields
    private String img;
    private String personalitySignature;
    private String address;
	private String sex;
    private Timestamp joinDatetime; 
	private String account;
	private String password;
	private String nickName;
	private Set<FoodMenu> foodMenus = new HashSet<FoodMenu>(0);
	private Set<Food> foods = new HashSet<Food>(0);

	// Constructors

	/** default constructor */
	public User() {
	}

	/** minimal constructor */
	public User(String account, String password) {
		this.account = account;
		this.password = password;
	}

	/** full constructor */
	public User(String img,String account, String password, String nickName,
			Set<FoodMenu> foodMenus, Set<Food> foods) {
		this.account = account;
		this.password = password;
		this.nickName = nickName;
		this.img=img;
		this.foodMenus = foodMenus;
		this.foods = foods;
	}
    @Column(name="img")
	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	// Property accessors
	@Id
	@Column(name = "account", unique = true, nullable = false, length = 50)
	public String getAccount() {
		return this.account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	@Column(name = "password", nullable = false)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "nick_name", length = 60)
	public String getNickName() {
		return this.nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<FoodMenu> getFoodMenus() {
		return this.foodMenus;
	}

	public void setFoodMenus(Set<FoodMenu> foodMenus) {
		this.foodMenus = foodMenus;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Food> getFoods() {
		return this.foods;
	}

	public void setFoods(Set<Food> foods) {
		this.foods = foods;
	}
    
    @Column(name = "personalitySignature")
	public String getPersonalitySignature() {
		return personalitySignature;
	}    
	public void setPersonalitySignature(String personalitySignature) {
		this.personalitySignature = personalitySignature;
	}
	@Column(name = "address")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	@Column(name = "sex")
	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}
	@Column(name = "joinDatetime")
	public Timestamp getJoinDatetime() {
		return joinDatetime;
	}

	public void setJoinDatetime(Timestamp joinDatetime) {
		this.joinDatetime = joinDatetime;
	}

}